package com.isoftstone.merchant.service.mprojecttype.impl;

import com.isoftstone.common.Page;
import com.isoftstone.merchant.dao.mprojecttype.MProjectTypeMapper;
import com.isoftstone.merchant.entity.mprojecttype.MProjectType;
import com.isoftstone.merchant.service.mprojecttype.MProjectTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * Created by as on 2017/12/12.
 * ///
 */
@Service
public class MprojectTypeServiceImpl implements MProjectTypeService{
    @Autowired
    MProjectTypeMapper mProjectTypeMapper;

    @Override
    public List<MProjectType> findprojecttypelistPage(Page page) throws Exception {
        return mProjectTypeMapper.selectMProjectTypelistPage(page);
    }

    @Override
    public List<MProjectType> checkName(Map<String, Object> map) throws Exception {
        return mProjectTypeMapper.checkName(map);
    }

    @Override
    @Transactional
    public void saveMProjectType(MProjectType mProjectType) throws Exception {
        mProjectTypeMapper.insertSelective(mProjectType);
    }

    @Override
    @Transactional
    public void updateMProjectType(MProjectType mProjectType) throws Exception {
        mProjectTypeMapper.updateByPrimaryKeySelective(mProjectType);
    }

    @Override
    public Integer getCountFromMProject(String mProjectId)throws Exception{
        return mProjectTypeMapper.selectCount(mProjectId);
    }
    @Override
    public void deleteMProjectType(Long  mProjectId)throws Exception{
        mProjectTypeMapper.deleteByPrimaryKey(mProjectId);
    }

    @Override
    public List<MProjectType> findProjectTypeList(){
        return mProjectTypeMapper.selectMProjectTypeList();
    }

    @Override
    public List<MProjectType> getProjectTypeNameByCropId(String corpId) throws Exception {
        return mProjectTypeMapper.getProjectTypeNameByCropId(corpId);
    }

    @Override
    public List<MProjectType> getTypeList(Map<String, Object> map) throws Exception {
        return mProjectTypeMapper.getTypeList(map);
    }
}
